//
// CVisualCollisionManagerUser.java
// Copyright (C) 2010  "Naush" <naush _ hotmail _ fr>
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program.  If not, see <http://www.gnu.org/licenses/>./* ----------------------------------------------------------------------------







package org.ryzom.nel.threed;

import org.ryzom.nel.misc.CVector;

public class CVisualCollisionManagerUser extends UVisualCollisionManager {
  private long swigCPtr;

  public CVisualCollisionManagerUser(long cPtr, boolean cMemoryOwn) {
    super(nel3dJNI.CVisualCollisionManagerUser_SWIGUpcast(cPtr), cMemoryOwn);
    swigCPtr = cPtr;
  }

  public static long getCPtr(CVisualCollisionManagerUser obj) {
    return (obj == null) ? 0 : obj.swigCPtr;
  }

  protected void finalize() {
    delete();
  }

  public synchronized void delete() {
    if (swigCPtr != 0) {
      if (swigCMemOwn) {
        swigCMemOwn = false;
        nel3dJNI.delete_CVisualCollisionManagerUser(swigCPtr);
      }
      swigCPtr = 0;
    }
    super.delete();
  }

  public void setLandscape(ULandscape landscape) {
    nel3dJNI.CVisualCollisionManagerUser_setLandscape(swigCPtr, this, ULandscape.getCPtr(landscape), landscape);
  }

  public UVisualCollisionEntity createEntity() {
    long cPtr = nel3dJNI.CVisualCollisionManagerUser_createEntity(swigCPtr, this);
    return (cPtr == 0) ? null : new UVisualCollisionEntity(cPtr, false);
  }

  public void deleteEntity(UVisualCollisionEntity entity) {
    nel3dJNI.CVisualCollisionManagerUser_deleteEntity(swigCPtr, this, UVisualCollisionEntity.getCPtr(entity), entity);
  }

  public void setSunContributionPower(float power, float maxThreshold) {
    nel3dJNI.CVisualCollisionManagerUser_setSunContributionPower(swigCPtr, this, power, maxThreshold);
  }

  public void setPlayerInside(boolean state) {
    nel3dJNI.CVisualCollisionManagerUser_setPlayerInside(swigCPtr, this, state);
  }

  public float getCameraCollision(CVector start, CVector end, float radius, boolean cone) {
    return nel3dJNI.CVisualCollisionManagerUser_getCameraCollision(swigCPtr, this, CVector.getCPtr(start), start, CVector.getCPtr(end), end, radius, cone);
  }

  public boolean getRayCollision(CVector start, CVector end, boolean landscapeOnly) {
    return nel3dJNI.CVisualCollisionManagerUser_getRayCollision(swigCPtr, this, CVector.getCPtr(start), start, CVector.getCPtr(end), end, landscapeOnly);
  }

  public long addMeshInstanceCollision(UVisualCollisionMesh mesh, SWIGTYPE_p_NLMISC__CMatrix instanceMatrix, boolean avoidCollisionWhenInside, boolean avoidCollisionWhenOutside) {
    return nel3dJNI.CVisualCollisionManagerUser_addMeshInstanceCollision(swigCPtr, this, UVisualCollisionMesh.getCPtr(mesh), mesh, SWIGTYPE_p_NLMISC__CMatrix.getCPtr(instanceMatrix), avoidCollisionWhenInside, avoidCollisionWhenOutside);
  }

  public void removeMeshCollision(long id) {
    nel3dJNI.CVisualCollisionManagerUser_removeMeshCollision(swigCPtr, this, id);
  }

  public void getMeshs(SWIGTYPE_p_NLMISC__CAABBox aabbox, SWIGTYPE_p_std__vectorT_NL3D__CMeshInstanceColInfo_t dest) {
    nel3dJNI.CVisualCollisionManagerUser_getMeshs(swigCPtr, this, SWIGTYPE_p_NLMISC__CAABBox.getCPtr(aabbox), SWIGTYPE_p_std__vectorT_NL3D__CMeshInstanceColInfo_t.getCPtr(dest));
  }

  public CVisualCollisionManager getVCM() {
    return new CVisualCollisionManager(nel3dJNI.CVisualCollisionManagerUser_getVCM(swigCPtr, this), false);
  }

}
